/**
 * 补齐补正操作的api  js
 */
import request from "@/utils/request";

const baseURL = process.env.VUE_APP_BASE_API;
/**
 * 分页查询补齐补正数据
 * @param {*} params
 */
export function queryPages(params) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH + "/zcbl/caseCorrection/queryPages",
    method: "get",
    params: params
  });
}

/**
 * 根据id查询补齐补正信息
 * @param {*} id
 */
export function getById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/zcbl/caseCorrection/getById/${id}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 保存告知信息
 * @param {*} data
 */
export function notifyCaseCorrection(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/zcbl/caseCorrection/notifyCaseCorrection`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: data
  });
}

/**
 * 补齐补正操作中 终止操作
 */
export function stopCaseCorrection(id, stopCause) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/zcbl/caseCorrection/stopCaseCorrection`,
    method: "get",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    params: {
      id: id,
      caseStopCause: stopCause
    }
  });
}

/**
 * 保存补齐补正数据
 * @param {*} data
 */
export function saveCaseCorrection(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/zcbl/caseCorrection/saveCaseCorrection`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: data
  });
}

/**
 * 返回补齐补正材料上传的地址
 */
export function uploadFile() {
  return (
    baseURL +
    process.env.VUE_APP_KSTB_ROUTE_PATH +
    "/case/caseAtta/uploadFileAndSaveTbCaseAtta"
  );
}

/**
 * 文件上传到附件表
 * @param {*} data
 */
export function uploadFileByFile(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/case/caseAtta/uploadFileAndSaveTbCaseAtta",
    method: "post",
    headers: {
      "Content-Type": " multipart/form-data"
    },
    data: data
  });
}

/**
 * 根据办件编号查询补齐补正的列表数据
 * @param {*} caseOid
 */
export function queryByCaseOid(caseOid) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/zcbl/caseCorrection/queryByCaseOid/${caseOid}`,
    method: "post",
    headers: {
      "Content-Type": " multipart/form-data"
    }
  });
}
